<template>
  <a-modal  v-model="visible" :width='900'   :title="title" footer=''>
    <div style='height: 500px;overflow: auto' ref="word"></div>
  </a-modal>
</template>

<script>
import ReportsEpidemicDailyService from '@/myService/ReportsEpidemicDailyService'
import ReportsEpidemicWeeklyService from '@/myService/ReportsEpidemicWeeklyService'
const docx = require("docx-preview");
window.JSZip = require("jszip");
export default {
  name: 'AdminHomeModal',
  data(){
    return{
      visible:false,
      title:'',
      timer:'',
      content:'',
    }
  },
  methods:{
    async open(row) {
      let beginDate=row.beginDate;
      let endDate=row.endDate;

      this.title = beginDate+"至"+endDate.substring(5)+ " 周报详情";
      let params={
        periodId:row.id,
        beginDate:row.beginDate
      }
      await this.getWord(params);
      this.visible = true
    },
    getWord(params){

      ReportsEpidemicWeeklyService.getWord(params).then(async (res) => {
        const blob = new Blob([res.data], {
          type: 'application/msword; charset=utf-8'
        })
        await docx.renderAsync(blob, this.$refs.word);
      }).catch(err=>{
        this.$message.error("暂无数据")
      })
    }
  }

}
</script>

<style scoped>

</style>